<template>
	<view class="login">
		<view class="imageBox">
			<image :src="image+'assets/web_img/p3.png'" mode="widthFix"></image>
		</view>
		<view class="btnBox">
			<!-- <button class="btn" open-type="getPhoneNumber"
				@getphonenumber="loginBtn">微信一键登录</button> -->
			<button class="btn" @tap.stop="loginBtn">微信一键登录</button>
			<button class="btn" @tap.stop="exitLogin" style="margin-top: 0;">取消</button>
			<view style="width: 90%; margin: 0 auto;">
				<u-checkbox-group>
					<u-checkbox v-model="checked" shape="circle" active-color="#000" label-disabled>
						<view class="" style="float: left;">
							我已阅读并同意
						</view>
						<view class="" style="float: left;">
							<view class="text" @tap.stop="Jump(4)">《用户协议》</view>和
							<view class="text" @tap.stop="Jump(1)">《隐私协议》</view>
						</view>
					</u-checkbox>
				</u-checkbox-group>
			</view>
		</view>
		<wxLoginPopup v-show="showPop" :showPop="showPop" @update="close" :optins="t" :mobile="mobile" @changeMobile="changeMobile" />
	</view>
</template>

<script>
	import wxLoginPopup from './login-popup.vue';
	export default {
		data() {
			return {
				image: this.$base.smallimgUrl,
				checked: true,
				showPop: false,
				mobile: '',
				t:null
			};
		},
		components: {
			wxLoginPopup
		},
		onLoad(options) {
			this.t = options
			console.log(this.t,'sss')
			this.$utils.toast(options)
		},
		methods: {
			exitLogin(){
				uni.switchTab({
					url: '/pages/tabBar/home/home'
				})
			},
			Jump(type){
				uni.navigateTo({
					url: '/pages/my/agreement/agreement?type=' + type
				})
			},
			changeMobile(){
				this.mobile = uni.getStorageSync('mobile')
			},
			// 点击登录
			loginBtn(e){
				let that = this
				if(!that.checked) return that.$utils.toast('请阅读勾选用户协议与隐私协议')
				// that.$api.getWxPhone({
				// 	code: e.detail.code
				// }).then(res => {
				// 	if (res.data.code == 1) {
				// 		this.mobile = res.data.data.mobile
				// 		uni.setStorageSync('mobile', this.mobile)
				// 		this.showPop = true
				// 	}
				// })
				this.showPop = true
			},
			close() {
				this.showPop = false
			},
		
		}
	}
</script>

<style lang="less">
	.login {
		width: 100vw;
		height: 100vh;
		position: relative;

		.imageBox {
			width: 100%;
			position: absolute;
			left: 0;
			top: 0;

			image {
				width: 100%;
			}

		}

		.btnBox {
			width: 100%;
			height: calc(100vh - 60%);
			background: #fff;
			position: absolute;
			border-top-left-radius: 50rpx;
			border-top-right-radius: 50rpx;
			position: absolute;
			left: 0;
			bottom: 0;

			.btn {
				width: 90%;
				height: 96rpx;
				background: #000;
				color: #fff;
				border-radius: 48rpx;
				text-align: center;
				line-height: 96rpx;
				font-size: 28rpx;
				font-weight: 500;
				margin: 30rpx auto;
				margin-top: 80rpx;
			}

			.text {
				display: inline-block;
				color: #000;
				font-weight: 500;
			}
		}
	}
</style>
